package jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCDemo3 {
    public static void main(String[] args) {
        try (
            Connection connection=DBUtil.getConnection();
        ){
            Statement state=connection.createStatement();
            String sql="select ID,name ,age,salary*12 sal,comm,gender "+
                    "from teacher ";
            ResultSet rs=state.executeQuery(sql);
            while (rs.next()){
                int id=rs.getInt("id");
                String name=rs.getString("name");
                int age=rs.getInt("age");
                int salary=rs.getInt("sal");
                int comm=rs.getInt("comm");
                String gender=rs.getString("gender");
                System.out.println(id+","+name+","+age+","+salary+","+comm+","+gender);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }


    }
}
